/* eslint-disable import/no-anonymous-default-export */
/* eslint-disable jsx-a11y/anchor-is-valid */

import { Navigate, Outlet, useLocation } from "react-router";
import React from 'react'
import { UserContext } from "../../store/user";

export default ()=>{
    const userObj = React.useContext(UserContext)
    const location = useLocation()

    // 0 是求职方
    if( !userObj.user || userObj.user.userType!='0' ){
        sessionStorage['user-type-tab'] = 'qiu_zhi'
        return <Navigate to="/login" state={{from: location, userType: 'qiu_zhi'}} replace />
    }

    return <Outlet />
}